<?php

class Zhishidi_Express_Block_Adminhtml_Map_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {

    protected function _prepareForm() {
        $form = new Varien_Data_Form();
        $this->setForm($form);
        $fieldset = $form->addFieldset('expressRateFieldset', array('legend' => Mage::helper('zhishidi_express')->__("Express Map information")));


        $zoneCollection = Mage::getModel('zhishidi_express/zone')->getCollection()->joinZoneType()->joinZoneGroup();
        $zoneArray = array();
        foreach ($zoneCollection as $zone) {
            $groupName = $zone->getGroupName();
            if (empty($groupName))
                $groupName = 'N/A';
            $zoneArray[] = array(
                'value' => $zone->getId(),
                'label' => $zone->getZoneName() . ' - ' . 'Type:' . $zone->getTypeName() . ' - ' . 'Group:' . $groupName,
            );
        }
        $fieldset->addField('map_zone', 'select', array(
            'name' => 'map_zone',
            'label' => Mage::helper('zhishidi_express')->__('Zone'),
            'title' => Mage::helper('zhishidi_express')->__('Zone'),
            'required' => true,
            'style' => 'width:500px;',
            'values' => $zoneArray,
        ));

        $fieldset->addField('map_country', 'select', array(
            'name' => 'map_country',
            'label' => Mage::helper('zhishidi_express')->__('Country'),
            'title' => Mage::helper('zhishidi_express')->__('Country'),
            'class' => 'required-entry',
             'values'  => Mage::getModel('adminhtml/system_config_source_country')->toOptionArray(),
            'required' => true,
        ));

    



        $fieldset->addField('map_state', 'text', array(
            'name' => 'map_state',
            'label' => Mage::helper('zhishidi_express')->__('State'),
            'title' => Mage::helper('zhishidi_express')->__('State'),
           

        ));

 

        if (Mage::getSingleton('adminhtml/session')->getExpressMapData()) {
            $form->setValues(Mage::getSingleton('adminhtml/session')->getExpressMapData());
            Mage::getSingleton('adminhtml/session')->setExpressMapData(null);
        } elseif (Mage::registry('express_map_data')) {
            $form->setValues(Mage::registry('express_map_data')->getData());
        }
        return parent::_prepareForm();
    }

}